package cn.com.main;

import cn.com.spring.annotation.Autowired;
import cn.com.spring.annotation.BeanScan;
import cn.com.spring.annotation.Component;
import cn.com.spring.auto.Application;

/**
 * 弹簧总成
 *
 * @author LiuGuodong
 * @date 2024/02/01
 */
@BeanScan("cn.com")
@Component
public class SpringMain {

    @Autowired
    private static AsyncDemo asyncDemo;

    public static void main(String[] args) throws Exception {
        //初始化bean工厂
        Application.run(SpringMain.class);
        System.out.println(Thread.currentThread().getName());
        //自己调用
        AsyncDemo asyncDemo1 = new AsyncDemo();
        asyncDemo1.asynchronousMethod(1);
        //通过代理对象调用自己的异步方法
        asyncDemo.asynchronousMethod(1);
        asyncDemo.sayHello();
        asyncDemo.sayHello2();
        asyncDemo.sayHello3();
    }
}
